import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { CompanyControversiesComponent } from './companyControversies.component';
import { CompanyControversiesService } from './companyControversies.service';
import { ChartsModule } from '../../../../shared/directives/charts.module';
import { MomentModule } from 'angular2-moment/moment.module';
import { ControversiesSummaryComponent } from './components/controversiesSummary/controversiesSummary.component';
import { ControversiesIncidentsComponent } from './components/controversiesIncidents/controversiesIncidents.component';
import { PipesModule } from '../../../../shared/pipes/pipes.module';
import { IncidentsByThemePipe } from './components/controversiesSummary/pipes/incidentsByTheme.pipe';
import { ControversiesEventIndicatorComponent } from './components/controversiesEventIndicator/controversiesEventIndicator.component';
import { ControversiesSummaryModule } from '../shared/companyControversiesSummary/companyControversiesSummary.module';
import { CompanyReportDownloadModule } from '../shared/companyHeader/companyReportDownload/companyReportDownload.module';
import { ModalModule } from '../../../../shared/components/modal/modal.module';
import { BulletScoreModule } from '../../../../shared/components/bulletScore/bulletScore.module';

const routes: Routes = [
    {
        path: '',
        component: CompanyControversiesComponent,
        children: [
            { path: '', redirectTo: 'summary', pathMatch: 'full' },
            {
                path: 'summary', component: ControversiesSummaryComponent, data: {
                    showAsMenu: true,
                    enabled: true,
                    menuItems: [{
                        title: 'Summary',
                        path: ['controversies', 'summary']
                    }]
                }
            },
            {
                path: 'incidents/:number', component: ControversiesIncidentsComponent, data: {
                    showAsMenu: true,
                    enabled: true //TODO: set claims if required and on menuItems update call enableMenuRoutes
                }
            }
        ]
    },
    { loadChildren: './companyControversies.widget#WidgetModule'} //added to route so we generate a chunk for it
]

/**
 * Company controversies module
 *
 * Author: Sorin Spiru
 * Date: 13.01.2018
 */
@NgModule({    
    imports: [
        CommonModule,
        FormsModule,
        MomentModule,
        ChartsModule,
        PipesModule,
        ModalModule,
        ControversiesSummaryModule,
        CompanyReportDownloadModule,
        BulletScoreModule,
        RouterModule.forChild(routes)
    ],
    declarations: [
        IncidentsByThemePipe,
        CompanyControversiesComponent,
        ControversiesSummaryComponent,
        ControversiesIncidentsComponent,
        ControversiesEventIndicatorComponent
    ]
})
export class CompanyControversiesModule { }
